<template>
    <div class="container">
        <el-button @click="handleGenerateCode">生成代码</el-button>
    </div>
</template>

<script lang="ts">
import generate from '@babel/generator';
import { Component, Vue } from 'vue-property-decorator'
import { generateCode } from '@/api/index'
@Component({
    name: 'SrcGeneration',
    components: {
    },
})
export default class extends Vue {

    // 添加
    private handleGenerateCode() {
        const { data } = generateCode({ tableNames: 'dish,employee' })
        let url = window.URL.createObjectURL(data)
        var a = document.createElement('a')
        document.body.appendChild(a)
        a.href = url
        a.download = '运营数据统计报表.xlsx'
        a.click()
        window.URL.revokeObjectURL(url)
    }

}
</script>

<style lang="scss" scoped>
.disabled-text {
    color: #bac0cd !important;
}
</style>
